/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ircserver;
import java.net.ServerSocket;
import java.net.Socket;
/**
 *
 * @author Justin
 */
public class IrcServer {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Users users = new Users();
        ServerSocket connect;
        try
        {
            connect= new ServerSocket(4444);
            while (true) {
                // wait for client to connect
                Socket socket;
                try
                {
                    socket = connect.accept();
                
 
                   // ok, connected, 
                   //now create ChatService to handle this connection
                    AddPerson service = new AddPerson(socket, users);
                    Thread thread = new Thread(service);
                    thread.start();

            
                // now, we go back to wait for next connection.
                }
                catch(Exception e ){System.out.println(e);}
            }
        }
        catch(Exception e ){System.out.println(e);}
        
    }
}
